package com.blue.firecat.enums;

/**
 * 描述
 * 时间 2017/6/22 22:05
 * 作者 廖林山
 */
public enum OrderTypeEnum {
    UNKNOWN(0, "未知"),
    /*EXPIRED(1, "订单过期"),*/
    WAITING(2, "等待接手"),
    IS_WORK(3, "正在代练"),
    TO_BE_ACCEPTED(4, "等待验收"),
    ABNORMAL_ORDERS(5, "订单异常"),
    HAS_BEEN_SETTLED(6, "已经结算"),
    APPOINT_BEATER(7, "指定打手"),
    TO_BE_SETTLED(8, "等待结算");

    private int code;
    private String value;

    OrderTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValueByCode(int code) {
        for (OrderTypeEnum type : OrderTypeEnum.values()) {
            if (code == type.getCode()) {
                return type.getValue();
            }
        }
        return UNKNOWN.value;
    }

    public static int getCodeByValue(String value) {
        for (OrderTypeEnum type : OrderTypeEnum.values()) {
            if (type.getValue().equals(value)) {
                return type.getCode();
            }
        }
        return UNKNOWN.code;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

}
